// 医保费用核查
import React from 'react';
import { Select, Input, Row, Col, Button, Spin, Divider, Popconfirm, message, Icon, Form, DatePicker, Table, Tabs, Modal, Card, Pagination, Popover, Checkbox } from 'antd';
import { $http } from 'containers/config/https';
import moment from 'moment';
import { Keup, ArraySome } from '../../../tools/index';
import PubilcTablePagination from '../../common/PubilcTablePagination.jsx'; // 公共table组件
import './style/style.less'
import store from '../../../store';
import TipHeader from './component/TipHeader'
import ReadCard from '../../../components/readcard/ReadCard';
import RangeDatePicker from 'components/rangePicker/index';
import CommonPagination from 'components/pagination/index';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import ListOfHospitalizationFeeQuery from './ListOfHospitalizationFeeQuery'
import { Util } from 'tools/index';
import { options } from 'less';
import PatientAccountManagement from './PatientAccountManagement.jsx';
import { PAGE_NUM_MORE_STATUS } from 'tools/statusConstants';

// 组件const
const { Option } = Select;
const { RangePicker } = DatePicker;
const dateFormat = 'YYYY-MM-DD' || undefined;
const { Search } = Input;
const { TabPane } = Tabs;
const cost_type = require('../../../assets/images/icon_Inquire.png')
const istvisits = require('../../../assets/images/icon_listvisits.png')
let patientData;
export default class HospitalizationFeeQuery extends React.Component {

    constructor(props) {
        super(props)
        patientData = window.sessionStorage.patientData ? JSON.parse(window.sessionStorage.patientData) : {}
        var userData = JSON.parse(sessionStorage.getItem('userData'))
        this.state = {
            userInfo: {}, // 用户数据
            dataTableTop: [], // table数据 上列表table
            dataTable1: [], // table数据 主列表table
            dataTable2: [], // table数据 折扣记账系数配置列表
            dataTable3: [], // table数据 不属于折扣内明细
            selectListData1: [],
            selectListData2: [],
            selectListData3: [],
            totalTop: 0,
            pageTop: 1,
            pageSizeTop: 20,
            // 表格数据总条数1
            total1: 0,
            page1: 1,
            pageSize1: 50,
            StartDateTop: undefined,  // //开始日期
            EndDateTop: undefined,  // //结束日期
            StartDate1: undefined,  // //开始日期
            EndDate1: undefined,  // //结束日期
            // 表格数据总条数2
            total2: 0,
            page2: 1,
            pageSize2: 100,

            cardType: '', // 卡类型
            cardTypeData: [], // 卡类型
            cardNo: '', // 卡号
            patNo: '',
            select1: '',
            select2: '',
            select3: '',
            nameNo: '',
            execID: [],
            ordID: '',
            modalShow: false,
            columnsTop: [],
            columns1: [],
            columns2: [],
            columns3: [],
            selectedRowKeys: [],
            money: {},
            bqType: '',
            jsType: '',
            chargeStatus: '',
            bqData: [],
            bedData: [],
            jsTypeData: [],
            time1: '1',
            allMoney: 0,
            readModeI: true,
            readModeR: true,
            languageData: {}, // 国际化语言包
            language: {},   // 国际化语言
            languageCode: JSON.parse(window.sessionStorage.userData).language, // 国际化语言标识
            ColumnAuthority: '',
            activeKey: '5', //Tab选择
            medicalNo: '',  // 住院号
            bednumber: '',
            userData: userData,
            dateTableInvoice: [], //发票表数据
            totalInvoice: 0,
            columnsInvoice: '',
            patNo: '',
            type: '',
            accColumns: [],
            accTableData: '',
            accTableDataCount: ''

        }

    }
    componentDidMount() {
        // 数据加载成功关闭loading
        this.child && this.child.handleLoading()

        this.cardTypeList() //卡类型

        this.selectList1() //卡类型
        this.selectList2() //卡类型
        this.selectList3() //卡类型

        this.jsList() //结算

        this.bqList() //病区

        this.cloumData()

        this.InvoiceList1()

        this.dataTableTopData()
        document.getElementById('patNo').focus();
        this.ordList1() //国际化
    }

    // 费用类型table
    ordList1 = () => {
        let data = {
            params: [{
                "reactCode": ["DischargeSettlement"],
                "compontName": "DischargeSettlement",
                "type": "C"

            }]
        }
        $http.post('urlS', this, {
            code: "01040073",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    this.setState({
                        languageData: res.result.language,  // 国际化语言包
                    }, () => {
                        this.LanCNEN(this.state.languageCode)
                    })
                }
            }
        });
    }

    LanCNEN = (code) => {
        let { languageData } = this.state
        this.setState({
            language: languageData[code]
        })
    }

    onColumnRef = (ref) => {
        this.columnRef = ref;
    }

    clearn = () => {
        this.setState({
            userInfo: {}, // 用户数据
            dataTableTop: [], // table数据 上列表table
            dataTable1: [], // table数据 主列表table
            dataTable2: [], // table数据 折扣记账系数配置列表
            dataTable3: [], // table数据 不属于折扣内明细
            totalTop: 0,
            pageTop: 1,
            pageSizeTop: 20,
            // 表格数据总条数1
            total1: 0,
            page1: 1,
            pageSize1: 10,
            StartDateTop: undefined,  // //开始日期
            EndDateTop: undefined,  // //结束日期
            StartDate1: undefined,  // //开始日期
            EndDate1: undefined,  // //结束日期
            // 表格数据总条数2
            total2: 0,
            page2: 1,
            pageSize2: 100,
            cardNo: '', // 卡号
            patNo: '',
            select1: '',
            select2: '',
            select3: '',
            nameNo: '',
            execID: [],
            ordID: '',
            modalShow: false,
            selectedRowKeys: [],
            money: {},
            bqType: '',
            jsType: '',
            chargeStatus: '',
            hospStatus: '',
            time1: '1',
            allMoney: 0,
            readModeI: true,
            readModeR: true,

        })
    }

    // 数据配置
    cloumData() {
        var data1 = {
            params: [{
                compontName: "IPOrdFeeList",
                type: 'C',
            }]
        }

        var data2 = {
            params: [{
                compontName: "HospitalizationFeeQuery",
                type: 'C',
            }]
        }

        var data3 = {
            params: [{
                compontName: "IPExecutiList",
                type: 'C',
            }]
        }


        var data4 = {
            params: [{
                compontName: "IPExecutiListChild",
                type: 'C',
            }]
        }


        $http.post('urlS', this, {
            code: "01040073",
            data: data1,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode == '0') {
                    let resC = res.result.C

                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }

                    var dynColumns = []
                    if (!Util.isEmpty(resC)) {
                        for (var i = 0; i < resC.length; i++) {
                            if (resC[i].dataIndex == 'expenses') {
                                dynColumns.push({
                                    ...resC[i],
                                    title: resC[i].title,
                                    dataIndex: resC[i].dataIndex,
                                    width: resC[i].width,
                                    align: resC[i].align,
                                    render: (text, data, index) => {
                                        return data.noINSUValue == 'Y' ? <Checkbox checked={data.noINSUFlag == 'Y' ? true : false}
                                            onChange={this.handleChangeCheckbox.bind(this, 'noINSUFlag', data, index)} /> : null
                                    }
                                })
                            } else {
                                dynColumns.push({
                                    ...resC[i],
                                    title: resC[i].title,
                                    dataIndex: resC[i].dataIndex,
                                    width: resC[i].width,
                                    align: resC[i].align,
                                })
                            }
                        }
                    }

                    this.setState({
                        columns1: dynColumns, // 费用类型table
                    }, () => {
                        this.columns1(this.state.columns1)
                        this.ordListAdd2('0', 0)    //render 自定义项目名称
                    });
                }
            }
        });

        $http.post('urlS', this, {
            code: "01040073",
            data: data2,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let resC = res.result.C

                    // for (var i = 0; i < resC.length; i++) {
                    //     resC[i].key = i;
                    //     if (resC[i].dataIndex === 'dinose') {
                    //         resC[i].dataIndex = 'diagnose'
                    //     }
                    // }
                    let { languageCode } = this.state

                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }

                    if (languageCode === "EN") {
                        resC.map((item, i) => {
                            item.title = item.enDescripts
                        })
                    }

                    if (languageCode === "CN") {
                        resC.map((item, i) => {
                            item.title = item.descripts
                        })
                    }
                    let arr = res.result && resC.length > 0 ? JSON.parse(JSON.stringify(resC)).map(item => {
                        return {
                            align: item.align,
                            widthNum: parseInt(item.width),
                            width: item.width,
                            dataIndex: item.dataIndex,
                            title: <div onDoubleClick={() => this.setState({ ColumnAuthority: 'HospitalizationFeeQuery' }, () => this.columnRef.onOpenModel())}>{item.title}</div>,
                            display: item.display,
                            key: item.seqNo,
                            sorter: ((item.dataIndex == 'patNo') || (item.dataIndex == 'MedicalNo') || (item.dataIndex == 'admDateTime') || (item.dataIndex == 'admBedNo') || (item.dataIndex == 'nuerseChargeDateTime') || (item.dataIndex == "admReasonDesc") || (item.dataIndex == "patName") || (item.dataIndex == "inDiagnose") || (item.dataIndex == "patBillTotalAmt") || (item.dataIndex == "outDiagnose")) ? true : false,
                        }
                    }) : '';
                    let filterArr = arr.filter(function (item) { return item.display === 'Y' });
                    this.setState({
                        columnsTop: filterArr, // 费用类型table
                    });
                }
            }
        });

        $http.post('urlS', this, {
            code: "01040073",
            data: data3,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let resC = res.result.C

                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }

                    this.setState({
                        columns2: resC, // 费用类型table
                    }, () => {
                        this.columns2(this.state.columns2)
                        this.columns2Add2()    //render 自定义项目名称
                    });
                }
            }
        });


        $http.post('urlS', this, {
            code: "01040073",
            data: data4,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let resC = res.result.C

                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }

                    this.setState({
                        columns3: resC, // 费用类型table
                    }, () => {
                        this.columns3(this.state.columns3)
                        this.columns3Add2()    //render 自定义项目名称
                    });
                }
            }
        });
    }

    handleChangeCheckbox(name, data, index, e) {
        this.state.dataTable1[index]['noINSUFlag'] = e.target.checked
        this.setState({}, () => {
            var params = {
                params: [{
                    ordDetailID: data.ordID,
                    userID: this.state.userData.userID,
                    noINSUFlag: e.target.checked == true ? 'Y' : 'N'
                }]
            }
            $http.post('urlDeault', this, {
                code: "03060032",
                data: params,
                success: function (res) {
                    if (res.errorCode == '0') {
                        message.success('操作成功！')
                        this.dataTable1DataChild(1)
                    }
                }
            });
        })
    }


    //render 自定义项目名称
    columns2Add2 = (i, indexs) => {
        let { columns2, languageCode } = this.state

        columns2.splice(7, 0, {
            title: languageCode === 'CN' ? "执行信息" : 'Executive Information',
            dataIndex: 'record',
            key: '26',
            align: "center",
            width: 200,
            render: (text, record) => (
                <span>
                    <span >{record.execRecLoc + '|' + record.execDateTime}</span>
                </span>
            ),
        })
        columns2.splice(8, 0, {
            title: languageCode === 'CN' ? "取消/停信" : 'Cancel / stop letter',
            dataIndex: 'record',
            key: '29',
            align: "center",
            width: 200,
            render: (text, record) => (
                <span>
                    <span >{record.execStopLoc + '|' + record.execStopDateTime}</span>
                </span>
            ),
        })
        this.setState({
            columns2: columns2, // 费用类型table
        });
    }


    //render 自定义项目名称
    columns3Add2 = (i, indexs) => {
        let { columns3, languageCode } = this.state

        columns3.splice(4, 0, {
            title: languageCode === 'CN' ? "计费信息" : 'Charging information',
            dataIndex: 'record',
            key: '32',
            align: "center",
            width: 200,
            render: (text, record) => (
                <span>
                    <span >{record.recLocDesc + '|' + record.billDateTime}</span>
                </span>
            ),
        })

        this.setState({
            columns3: columns3, // 费用类型table
        });
    }

    // 数据配置
    columns1(resC) {

        let { languageCode } = this.state
        for (var i = 0; i < resC.length; i++) {
            resC[i].key = i;
        }
        if (languageCode === "EN") {
            resC.map((item, i) => {
                item.title = item.enDescripts
            })
        }

        if (languageCode === "CN") {
            resC.map((item, i) => {
                item.title = item.descripts
            })
        }

        this.setState({
            columns1: resC, // 费用类型table
        });
    }

    // 数据配置
    columnsTop(resC) {

        let { languageCode } = this.state
        for (var i = 0; i < resC.length; i++) {
            resC[i].key = i;
        }
        if (languageCode === "EN") {
            resC.map((item, i) => {
                item.title = item.enDescripts
            })
        }

        if (languageCode === "CN") {
            resC.map((item, i) => {
                item.title = item.descripts
            })
        }

        this.setState({
            columnsTop: resC, // 费用类型table
        });
    }

    columns2(resC) {

        let { languageCode } = this.state
        for (var i = 0; i < resC.length; i++) {
            resC[i].key = i;
        }
        if (languageCode === "EN") {
            resC.map((item, i) => {
                item.title = item.enDescripts
            })
        }

        if (languageCode === "CN") {
            resC.map((item, i) => {
                item.title = item.descripts
            })
        }

        this.setState({
            columns2: resC, // 费用类型table
        });
    }

    columns3(resC) {

        let { languageCode } = this.state
        for (var i = 0; i < resC.length; i++) {
            resC[i].key = i;
        }
        if (languageCode === "EN") {
            resC.map((item, i) => {
                item.title = item.enDescripts
            })
        }

        if (languageCode === "CN") {
            resC.map((item, i) => {
                item.title = item.descripts
            })
        }

        this.setState({
            columns3: resC, // 费用类型table
        });
    }

    //render 自定义项目名称
    ordListAdd1 = (i, indexs) => {
        let { columnsTop } = this.state

        columnsTop.splice(9, i, {
            title: '操作申请',
            dataIndex: 'record',
            key: '9999',
            align: "center",
            width: 100,
            render: (text, record) => (
                <span>
                    <span className='span' >打印费用清单</span>
                </span>
            ),
        })


        this.setState({
            columnsTop: columnsTop, // 费用类型table
        });
    }

    //render 自定义项目名称
    ordListAdd2 = (i, indexs) => {
        let { columns1 } = this.state

        columns1.splice(9, i, {
            title: '开嘱信息',
            dataIndex: 'record',
            key: '888',
            align: "center",
            width: 100,
            render: (text, record) => (
                <span>
                    <span >{record.ordLoc + '|' + record.ordDateTime}</span>
                </span>
            ),
        }, {
            title: '取消/停嘱信息',
            dataIndex: 'invType',
            key: '999',
            align: "center",
            width: 100,
            render: (text, record) => (
                <span>
                    <span >{record.ordStopLoc + '|' + record.ordStopDateTime}</span>
                </span>
            ),

        })


        this.setState({
            columns1: columns1, // 费用类型table
        });
    }


    //卡类型
    cardTypeList = () => {
        var data = {
            params: [{
                hospID: JSON.parse(window.sessionStorage.userData).hospID, //医院id 
            }]
        }

        $http.post('urlS', this, {
            code: "01040059",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let cardDeffault = res.cardType.filter((item) => {
                        return item.defaultFlag === 'Y';
                    })
                    this.setState({
                        cardType: cardDeffault[0].id, // 默认卡
                        cardTypeData: res.cardType,  // 用户数据
                    }, () => {
                        this.CardTypeChange(this.state.cardType)
                    });
                }
            }
        });
    }

    //1.1.49.住院费用明细相关下拉框（病区）
    bqList = () => {
        var data = {
            params: [{
                "hospID": JSON.parse(window.sessionStorage.userData).hospID || '', //医院id 
                "type": "W",
                "status": "1",
            }]
        }

        $http.post('urlS', this, {
            code: "04020008",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {

                    this.setState({
                        bqData: res.result.Data || [], // 数据
                    });
                    for (var i = 0; i < res.result.Data.length; i++) {
                        if (res.result.Data[i].id == JSON.parse(window.sessionStorage.userData).locID) {
                            this.setState({
                                bqType: res.result.Data[i].id
                            }, () => this.BedChange(res.result.Data[i].id))
                            break;
                        }

                    }

                }
            }
        });
    }

    //1.1.49.住院费用明细相关下拉框（结算）
    jsList = () => {
        var data = {
            params: [{
                "hospID": JSON.parse(window.sessionStorage.userData).hospID || '', //医院id 
            }]
        }

        $http.post('urlS', this, {
            code: "05100129",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {

                    this.setState({
                        jsTypeData: res.data || [], // 数据
                    });
                }
            }
        });
    }


    //1.1.49.住院费用明细相关下拉框（医嘱状态）
    selectList1 = () => {
        var data = {
            params: [{
                "use": "",   //使用类型
            }]
        }

        $http.post('urlS', this, {
            code: "05100140",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {

                    this.setState({
                        selectListData1: res.data, // 数据
                    });
                }
            }
        });
    }

    //1.1.50.住院费用明细相关下拉框（根据就诊获取执行科室下拉框）
    selectList2 = () => {
        var data = {
            params: [{
                "admID": this.state.admID,
                "type": "REC"
            }]
        }

        $http.post('urlS', this, {
            code: "05100141",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {

                    this.setState({
                        selectListData2: res.data, // 数据
                    });
                }
            }
        });
    }

    //1.1.51.住院费用明细相关下拉框（根据就诊类型代码获取医嘱类型）
    selectList3 = () => {
        var data = {
            params: [{
                "admTypeCode": "", //就诊类型代码
            }]
        }

        $http.post('urlS', this, {
            code: "05100142",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {

                    this.setState({
                        selectListData3: res.data, // 数据
                    });
                }
            }
        });
    }


    // 回车查询登记号
    patNodownE = (e, type) => {
        if (e.keyCode === 13) {
            this.searchUser(type)
        }
    }


    // 读卡 --- 根据卡号取病人信息
    handleReadCard = (value, event) => {
        let { readModeI, readModeR, cardType } = this.state
        if (event.keyCode) {
            if (readModeI) {
                this.searchUser('cardNo'); // 重新调用查询接口
            }
            return false
        }
        if (readModeR) {
            this.readCard.ReadCard(cardType, "R", (json) => {
                let patNo = json && json.patInfo ? json.patInfo.patNo : ''
                this.setState({ patNo , cardNo: json.cardNo }, () => {

                    //this.searchUser('cardNo'); // 重新调用查询接口
                    if (patNo)
					{
						this.searchUser('patNo'); // 重新调用查询接口
					}else{
						this.searchUser('cardNo'); // 重新调用查询接口
					}
                })
            })
        }

    }

    // // 回车读卡 --- 根据卡号取病人信息
    // handleReadCarddownE = (e, type) => {
    //     if (e.keyCode === 13) {

    //         this.searchUser('cardNo') // 读卡 --- 根据卡号取病人信息
    //     }
    // }


    // 读卡
    searchUser = (type) => {
        var data;
        let { cardType, cardNo, patNo, cardTypeData } = this.state
        if (!type) {   // 查询全部
            data = {
                params: [{
                    "number": patNo || '', // 登记号/身份证号
                    "cardTypeID": cardType,   //卡类型id
                    "cardNo": cardNo,    //卡号
                }]
            }
        }

        if (type === 'patNo') {
            data = {
                params: [{
                    "number": patNo || '', // 登记号/身份证号
                    "cardTypeID": "",   //卡类型id
                    "cardNo": "",    //卡号
                }]
            }

            if (patNo === '') {
                return false
            }
        }

        if (type === 'cardNo') {
            data = {
                params: [{
                    "number": '', // 登记号/身份证号
                    "cardTypeID": cardType || '',     //卡类型id
                    "cardNo": cardNo || '', //卡号
                }]
            }

            if (cardNo === '') {
                return false
            }
            if (cardType === '') {
                message.error('请选择卡类型')
                return false
            }


            let cardTypeFilter = cardTypeData.filter(function (item) {
                return item.id == cardType;
            })

            let zeroLength = cardTypeFilter[0].cardLength

            if (zeroLength && zeroLength != '' && parseFloat(zeroLength) != 0) {
                this.setState({
                    cardNo: ArraySome.addPreZero(cardNo, zeroLength)
                })
                data = {
                    params: [{
                        "number": '', // 登记号/身份证号
                        "cardTypeID": cardType || '',     //卡类型id
                        "cardNo": ArraySome.addPreZero(cardNo, zeroLength) || '', //卡号
                    }]
                }
            }
        }
        $http.post('urlS', this, {
            code: "03040004",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    this.setState({
                        userInfo: res.data || {},  // 用户数据
                        patNo: res.data.patNo || '',  // ID
                    }, () => {
                        this.dataTableTopData() // 就诊信息
                    });

                }
            }
        });
    }

    // 查询条件 --- 病区
    bqType = (e) => {
        this.setState({ bqType: e }, () => {
            this.BedChange(e)
            this.dataTableTopData();
        });
    }

    // 查询条件 --- 结算
    jsType = (e) => {
        this.setState({ jsType: e });
    }
    // 查询条件 --- 时间类型
    time1 = (e) => {
        this.setState({ time1: e });
    }

    // 查询条件 --- 结算类型
    chargeStatus = (e) => {
        this.setState({ chargeStatus: e });
    }
    // 查询条件 --- 在院状态
    hospStatus = (e) => {
        this.setState({ hospStatus: e });
    }
    // 查询条件 --- 登记号
    patNo = (e) => {
        this.setState({ patNo: e.target.value });
    }
    // 住院号
    medicalNo = (e) => {
        this.setState({ medicalNo: e.target.value });
    }

    // 查询条件 --- 卡类型·
    cardType = (e) => {
        this.setState({ cardType: e }, () => {
            this.CardTypeChange(e)
        });
    }
    // 查询条件 --- 卡号
    cardNo = (e) => {
        let { readModeI } = this.state
        if (!readModeI) {
            return false
        }
        this.setState({ cardNo: e.target.value });
    }

    // Card
    CardTypeChange = (e) => {
        if (!e) {
            return false
        }
        let { cardTypeData } = this.state
        let readMode = cardTypeData.filter((item, i) => {
            return item.id == e;
        })

        switch (readMode[0] && readMode[0].readMode) {
            // 只可input
            case 'I':
                this.setState({
                    readModeI: true,
                    readModeR: false,
                    cardNo: "",

                })
                break;
            // 只可读卡
            case 'R':
                this.setState({
                    readModeR: true,
                    readModeI: false,
                    cardNo: "",
                })
                break;
            // 皆可
            default:
                this.setState({
                    readModeI: true,
                    readModeR: true,
                    cardNo: "",
                })
                break;
        }

    }

    // 查询条件
    select1 = (e) => {
        this.setState({ select1: e });
    }

    // 查询条件 
    select2 = (e) => {
        this.setState({ select2: e });
    }

    // 查询条件 
    select3 = (e) => {
        this.setState({ select3: e });
    }


    // 查询条件
    nameNo = (e) => {
        this.setState({ nameNo: e.target.value });
    }

    // 回车查询nameNo
    nameNodownE = (e) => {
        if (e.keyCode === 13) {
            this.dataTable1Data()
        }
    }

    // 时间
    onChangeTimeTop = (date, dateString) => {
        this.setState({
            StartDateTop: dateString[0],    //开始日期
            EndDateTop: dateString[1],  //结束日期
        })

    }

    startChange(date) {
        this.setState({
            StartDateTop: date,
        })
    }

    endChange(date) {
        this.setState({
            EndDateTop: date,
        })
    }




    // 时间
    onChangeTime1 = (date, dateString) => {
        this.setState({
            StartDate1: dateString[0],    //开始日期
            EndDate1: dateString[1],  //结束日期
        })

    }

    startChange1(date) {
        this.setState({
            StartDate1: date,
        })
    }

    endChange1(date) {
        this.setState({
            EndDate1: date,
        })
    }

    // 1.1.52.住院费用明细相关接口（就诊信息及费用信息接口）
    dataTableTopData = (e) => {
        let { pageSizeTop, pageTop, StartDateTop, EndDateTop, time1, bqType, jsType, cardType, cardNo, patNo, chargeStatus, dataTableTop, medicalNo, activeKey, bednumber, hospStatus, type } = this.state
        if (activeKey == 2) {
            //住院费用日清单事件
            let parameterData = {
                "patNo": patNo,
                "cardTypeID": '',
                "patID": '',
                "medicalNo": medicalNo,
                "EndDateTop": EndDateTop,
                "StartDateTop": StartDateTop,
                "wardID": bqType,
                "payReasonID": jsType,
                "cardNo": cardNo,
                "bednum": bednumber,

            }
            this.onHospRef.TabsChang(parameterData)
            return
        }
        var data = {
            params: [{
                "number": patNo || '', // 登记号/身份证号
                "cardTypeID": cardType,   //卡类型id
                "cardNo": cardNo,    //卡号
                hospID: JSON.parse(window.sessionStorage.userData).hospID || '', //医院id 
                patID: dataTableTop.length == 0 ? patientData.patID : '',  //病人id
                medicalNo: medicalNo,
                "stopDate": EndDateTop,
                "startDate": StartDateTop,
                "condition": time1,
                "wardID": bqType, //病区
                "payReasonID": jsType,  //费别
                "chargeStatus": chargeStatus,
                "bedID": bednumber,// 床号
                "hospStatus": hospStatus, //在院状态,
                "type": type,

            }],
            /**
             * @ByShizi: 分页异常处理
             * Create 2021-07-25
             * */
            pagination: [{
                pageSize: pageSizeTop,
                currentPage: pageTop,
                sortColumn: this.state.sortColumn,
                sortOrder: this.state.sortOrder
            }]
        }

        $http.post('urlS', this, {
            code: "05100371",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let temRecord = {}
                    for (var i = 0; i < res.data.length; i++) {
                        res.data[i].key = i;
                        if (res.data[i].patID == patientData.patID) {
                            patNo = res.data[i].patNo
                            temRecord = res.data[i]
                        }
                    }
                    this.setState({
                        dataTableTop: res.data,
                        totalTop: res.total,
                    }, () => { if (!Util.isEmpty(temRecord)) this.onClickRowPublicTop(temRecord) });

                }
            }
        });

    }
    handleChange = (pagination, filters, sorter, extra) => {
        if (!Util.isEmpty(sorter)) {
            this.setState({
                type: sorter.field,
                sortOrder: sorter.order == 'descend' ? 'desc' : 'asc',
                sortColumn: sorter.columnKey,
                page: 1
            }, () => {
                this.dataTableTopData()
            })
        }
    };
    // // 1.1.52.住院费用明细相关接口（医嘱清单）
    dataTable1Data = (e) => {
        if (!this.state.admID || this.state.admID === '') {
            message.error('请先选择就诊信息')
            return false
        }

        var data2 = {
            params: [{
                "admID": this.state.admID || '', //就诊ID,
                "userID": JSON.parse(window.sessionStorage.userData).userID, //人员id
                'ordExecStr': ''
            }]
        }
        $http.post('urlS', this, {
            code: "05300012",
            data: data2,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    this.dataTable1DataChild()
                }
            }
        });


    }

    dataTable1DataChild = () => {
        let { pageSize1, page1, StartDate1, EndDate1 } = this.state
        this.selectList2()
        var data = {
            params: [{
                "admID": this.state.admID || '', //就诊ID
                "admLocID": this.state.select2 || '', //科室下拉框
                "priorityID": this.state.select3 || '', //医嘱优先级下拉框
                "ordStatusID": this.state.select1 || '', //医嘱状态下拉框
                "medDesc": this.state.nameNo || '', //输入框
                "stDate": this.state.StartDate1 || '', //时间
                "endDate": this.state.EndDate1 || '',//时间
            }],
            pagination: [{
                pageSize: pageSize1,
                currentPage: page1,
            }]
        }

        $http.post('urlS', this, {
            code: "05210031",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    for (var i = 0; i < res.data.length; i++) {
                        res.data[i].key = i;
                    }
                    this.setState({
                        dataTable1: res.data,
                        total1: res.total,
                        allMoney: res.totalAmt,
                        execID: ''
                    });

                } else {
                    this.setState({
                        dataTable1: [],
                        total1: 0,
                        allMoney: 0,
                    })
                }
            }
        });

    }
    // 1.1.52.住院费用明细相关接口（执行记录）
    dataTable2Data = (e) => {
        let { pageSize2, page2 } = this.state
        if (!this.state.ordID || this.state.ordID === '') {
            message.error('请先选择医嘱清单')
            return false
        }
        var data = {
            params: [{
                ordID: this.state.ordID,  //医嘱ID
            }],
            pagination: [{
                pageSize: pageSize2,
                currentPage: page2,
            }]
        }

        $http.post('urlS', this, {
            code: "05210032",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    for (var i = 0; i < res.data.length; i++) {
                        res.data[i].key = i;
                    }
                    this.setState({
                        dataTable2: res.data,
                        total2: res.total,
                        selectedRowKeys: [],
                        dataTable3: [],
                    }, () => {
                        //this.onClickRowPublic2(res.data)
                    });

                } else {
                    this.setState({
                        dataTable2: [],
                        total2: 0,
                        selectedRowKeys: [],
                        dataTable3: [],
                    })
                }
            }
        });
    }
    // 1.1.52.住院费用明细相关接口（ 费用明细）
    dataTable3Data = (record) => {
        if (!record.execID || record.execID === '') {
            message.error('请先选择医嘱清单')
            return false
        }
        var data = {
            params: [{
                patBillMIDArr: record.patBillMID,  //执行记录ID
            }]
        }

        $http.post('urlS', this, {
            code: "05210033",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    for (var i = 0; i < res.data.length; i++) {
                        res.data[i].key = i;
                    }
                    this.setState({
                        dataTable3: res.data
                    });

                }
            }
        });
    }


    // 操作行
    onClickRowPublicTop = (record) => {
        this.setState({ money: record, admID: record.admID, dataTable1: [], dataTable2: [], dataTable3: [], }, () => {
            this.dataTable1Data()
        })
        this.setState({ patNo: record.patNo }, () => {
        })

        var data = {
            params: [{
                "number": record.patNo || '', // 登记号/身份证号
                "cardTypeID": "",   //卡类型id
                "cardNo": "",    //卡号
            }]
        }

        $http.post('urlS', this, {
            code: "03040004",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {

                    this.setState({
                        userInfo: res.data || [],  // 用户数据
                        // patNo: res.data.patNo || '',  // ID
                    });

                }
            }
        });
    }

    // 选中行操作
    setRowClassNamePublicTop = (record) => {
        return record.admID === this.state.admID ? 'clickRowStyle' : '';
    }


    // 操作行
    onClickRowPublic1 = (record) => {
        return {
            // 单击行选中
            onClick: () => {
                this.setState({ ordID: record.ordID, execID: '' }, () => {
                    this.dataTable2Data()
                })

            }
        }
    }
    // 选中行操作
    setRowClassNamePublic1 = (record) => {

        return record.ordID === this.state.ordID ? 'clickRowStyle' : '';
    }
    //查询床位
    BedChange = (locID) => {
        let data = {
            params: [{
                locID: locID,
            }]
        }
        $http.post('urlS', this, {
            code: "01050021",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    this.setState({ bedData: res.result.Data })
                }
            }
        })
    }
    // 选中行操作
    setRowClassNamePublic2 = (record) => {
        return record.execID === this.state.execID ? 'clickRowStyle' : '';
    }
    // 调用公共组件的连接 事 件
    onRef = (ref) => {
        this.child = ref
    }

    hospRef = (ref) => {
        this.onHospRef = ref
    }

    // 显示分页总条数
    showTotal(total) {
        return `共 ${total} 条`;
    }


    // 提供修改page和pageSize的回调函数
    compilePage(page, pageSize) {
        // 修改page，或者pageSize
        this.setState({ page1: page, pageSize1: pageSize }, () => {
            // 重新调用查询方法
            this.dataTable1Data();
        })
    }

    onChangeTop = (page, pageSize) => {
        this.setState({ pageTop: page, pageSizeTop: pageSize }, () => {
            // 重新调用查询方法
            this.dataTableTopData();
        })
    }

    // 条数改变的回调
    onShowSizeChangeTop = (current, size) => {
        this.setState({ pageTop: 1, pageSizeTop: size }, () => {
            // 重新调用查询方法
            this.dataTableTopData();
        })

    }

    // 页码改变的回调，参数是改变后的页码及每页条
    onChange2 = (page, pageSize) => {
        this.setState({ page2: page, pageSize2: pageSize }, () => {
            // 重新调用查询方法
            this.dataTable2Data();
        })
    }

    // 条数改变的回调
    onShowSizeChange2 = (current, size) => {
        this.setState({ page2: 1, pageSize2: size }, () => {
            // 重新调用查询方法
            this.dataTable2Data();
        })

    }


    // 弹框关闭
    handleCancel = () => {
        this.setState({
            modalShow: false
        })
    }

    // 查询条件 --- 床位
    bednum = (e) => {
        this.setState({ bednumber: e });
    }
    Selectbednum = (e) => {
        this.setState({ bednumber: e }, () => this.dataTableTopData());
    }
    //checkChange
    onSelectChange = (selectedRowKeys, selectedRows) => {
        this.setState({
            selectedRowKeys: selectedRowKeys,
        }, () => {
            this.onClickRowPublic2(selectedRows)
        })

    }

    //确认modal
    rowSelection = () => {
        let { execID } = this.state
        if (execID.length > 0) {
            this.setState({ modalShow: true })
        } else {
            message.warning('请选择执行记录')
        }

    }

    // 切换tabs的回调
    callback = (key) => {
        let { pageSizeTop, pageTop, StartDateTop, EndDateTop, time1, bqType, jsType, cardType, cardNo, patNo, chargeStatus, dataTableTop, medicalNo } = this.state
        this.setState({ activeKey: key }, () => {
            if (key == 0) {//切换菜单默认关闭loading
                this.child && this.child.handleLoading()
            }
            if (key == 2) {
                //住院费用日清单事件
                let parameterData = {
                    "patNo": patNo,
                    "cardTypeID": '',
                    "patID": '',
                    "medicalNo": medicalNo,
                    "EndDateTop": EndDateTop,
                    "StartDateTop": StartDateTop,
                    "wardID": bqType,
                    "payReasonID": jsType,
                    "cardNo": cardNo,
                }
                this.onHospRef.TabsChang(parameterData)
            }
            if (key == 3) {
                this.tableData()

            }
            if (key == 4) {
                this.tableList()
                this.accTableData()
            }
        });
    }

    // 获取预交金明细列表columns
    tableList = (reactCode, compontName) => {
        var data = {
            params: [{
                "reactCode": ["PatientAccountManagement"],
                "compontName": "PatientAccountManagement",
                "type": "C"
            }]
        }
        $http.post('urlS', this, {
            code: '01040073',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let resC = res.result.C
                    let { languageCode } = this.state
                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }
                    if (languageCode === "EN") {
                        resC.map((item, i) => {
                            item.title = item.enDescripts
                        })
                    }

                    if (languageCode === "CN") {
                        resC.map((item, i) => {
                            item.title = item.descripts
                        })
                    }
                    let arr = res.result && resC.length > 0 ? JSON.parse(JSON.stringify(resC)).map(item => {
                        return {
                            align: item.align,
                            widthNum: parseInt(item.width),
                            width: item.width,
                            dataIndex: item.dataIndex,
                            title: <div onDoubleClick={() => this.columnRef.onOpenModel()}>{item.title}</div>,
                            display: item.display,
                            key: item.seqNo
                        }
                    }) : '';
                    let filterArr = arr.filter(function (item) { return item.display === 'Y' });
                    this.setState({
                        accColumns: filterArr,
                    }, () => {
                        this.LanCNEN(this.state.languageCode)
                    })
                }
            }
        })
    }
    ///预交金明细数据
    accTableData = () => {
        let data = {
            params: [{
                "patID": this.state.patID,
                "admID": this.state.admID
            }]
        };
        $http.post('urlS', this, {
            code: "05100391",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let orderSpan = {};
                    let resC = res.date
                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }

                    // resC && resC.map(item => {
                    //     orderSpan[item.icID] = Util.isEmpty(orderSpan[item.icID]) ? 1 : orderSpan[item.icID] + 1;
                    // })
                    this.setState({
                        accTableData: resC, // 列表数据
                        accTableDataCount: res.totalCount,
                    });
                } else {
                    this.setState({
                        accTableData: [], // 列表数据
                        accTableDataCount: 0,
                    })
                }
            }
        });

    }
    getAdmID = () => {
        return this.state.admID;
    }

    handleExecList(name) {
        this.handleDealExecList(name)
    }

    //执行、撤销、停止执行
    handleDealExecList(name, dateFrom, timeFrom) {
        var params = {}
        if (name == 'F') {
            params = {
                params: [{
                    ordIDs: [this.state.execID],
                    locID: this.state.userData.locID,
                    userID: this.state.userData.userID,
                    date: dateFrom,
                    time: timeFrom,
                    code: name,
                }]
            }
        } else {
            params = {
                params: [
                    {
                        ordIDs: [this.state.execID],
                        locID: this.state.userData.locID,
                        userID: this.state.userData.userID,
                        code: name,
                    }
                ]
            }
        }
        $http.post('urlDeault', this, {
            code: "04030003",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    if (!Util.isEmpty(res.errorArr)) {
                        message.error((res.errorArr).join(','))
                    } else {
                        message.success('操作成功！')
                    }
                    this.dataTable2Data()
                    this.setState({
                        execID: []
                    })
                }
            }
        });
    }
    // 费用类型table
    InvoiceList1 = () => {
        let data = {
            params: [{
                "reactCode": ["InvoiceInformation"],
                "compontName": "InvoiceInformation",
                "type": "C"

            }]
        }
        $http.post('urlS', this, {
            code: "01040073",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let resC = res.result.C
                    let { languageCode } = this.state

                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }

                    if (languageCode === "EN") {
                        resC.map((item, i) => {
                            item.title = item.enDescripts
                        })
                    }

                    if (languageCode === "CN") {
                        resC.map((item, i) => {
                            item.title = item.descripts
                        })
                    }
                    let arr = res.result && resC.length > 0 ? JSON.parse(JSON.stringify(resC)).map(item => {
                        if (item.dataIndex == 'icDesc') {
                            return {
                                align: item.align,
                                widthNum: parseInt(item.width),
                                width: item.width,
                                dataIndex: item.dataIndex,
                                title: <div onDoubleClick={() => this.columnRef.onOpenModel()}>{item.title}</div>,
                                display: item.display,
                                key: item.seqNo,
                                render: (value, data, index) => {
                                    if (index === 0) {
                                        this.state.span = {};
                                    }
                                    const obj = {
                                        children: value,
                                        props: {}
                                    }
                                    // if (Util.isEmpty(this.state.span[data.icID])) {
                                    //     obj.props.rowSpan = this.state.orderSpan[data.icID];
                                    //     this.state.span[data.icID] = 1;
                                    // } else {
                                    //     obj.props.rowSpan = 0;
                                    // }
                                    return obj;
                                },
                            }
                        } else {
                            return {
                                align: item.align,
                                widthNum: parseInt(item.width),
                                width: item.width,
                                dataIndex: item.dataIndex,
                                title: <div onDoubleClick={() => this.columnRef.onOpenModel()}>{item.title}</div>,
                                display: item.display,
                                key: item.seqNo
                            }
                        }
                    }) : '';
                    let filterArr = arr.filter(function (item) { return item.display === 'Y' });
                    this.setState({
                        columnsInvoice: filterArr, // 费用类型table
                        languageData: res.result.language || {},  // 国际化语言包
                    }, () => {
                        // this.columns1(this.state.columns1)
                        this.LanCNEN(this.state.languageCode)
                    })
                }
            }
        });
    }
    tableData = () => {
        var data = {
            params: [{
                hospID: JSON.parse(window.sessionStorage.userData).hospID || '', //医院id 
                admID: this.state.admID ? this.state.admID : ''

            }]
        }
        $http.post('urlS', this, {
            code: "05100378",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let orderSpan = {};
                    let resC = res.date
                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }

                    // resC && resC.map(item => {
                    //     orderSpan[item.icID] = Util.isEmpty(orderSpan[item.icID]) ? 1 : orderSpan[item.icID] + 1;
                    // })
                    this.setState({
                        dateTableInvoice: resC, // 列表数据
                        totalInvoice: res.totalCount,
                    });
                } else {
                    this.setState({
                        dateTableInvoice: [], // 列表数据
                        totalInvoice: 0,
                    })
                }
            }
        });

    }
    render() {
        // 组件所需参数
        const paramTop = {

            // 数据总条数
            total: this.state.totalTop,
            // 数据页数
            page: this.state.pageTop,
        }

        // 组件所需参数
        const param = {
            // 表头配置
            columns: this.state.columns1,
            // 表格数据
            data: this.state.dataTable1,
            // 数据总条数
            total: this.state.total1,
            // 数据页数
            page: this.state.page1,
            size: "large",
            // pageSize:'20',
            // x: 1600,
            height: store.getState().tableHeight.y - 24 + 'px',
            y: store.getState().tableHeight.y - 70,
            x: 1100,
            isOnRow: true,
            rowClassName: true
        }

        // 组件所需参数
        const param2 = {
            // 表头配置
            columns: this.columns2,
            // 表格数据
            data: this.state.dataTable2,
            // 数据总条数
            total: this.state.total2,
            // 数据页数
            page: this.state.page2,
        }

        let rowSelection = {
            selectedRowKeys: this.state.selectedRowKeys,
            onChange: this.onSelectChange,
        };
        let { language, activeKey } = this.state

        return (
            <div style={{ background: '#e8e8e8', height: '100%', overflow: 'hidden' }} className='hospital-zation-express'>
                <ReadCard ref={r => this.readCard = r} />
                <Row>
                    <Col span={5}>
                        <Card style={{ width: '100%', padding: '0' }}
                            title={<span><img src={cost_type} style={{ marginRight: 5 }} />{language.DischargeSettlementQueryvisitrecords && language.DischargeSettlementQueryvisitrecords.descripts} </span>}>
                            <div style={{ padding: 12, paddingBottom: "32px", position: "relative" }}>
                                <div style={{ lineHeight: '32px', height: store.getState().tableHeight.y + 132, overflow: "auto" }}>

                                    {this.state.bqType != '' ? <Row className='mB10'>
                                        <Col span={25}>
                                            <Input.Group>
                                                <Input className='express-input-disable' style={{ width: '25%', textAlign: 'center' }} value={language.DischargeSettlementBednumber && language.DischargeSettlementBednumber.descripts + '：'} disabled />
                                                <Select className='express-select-border' allowClear showSearch style={{ width: '74.9%' }} placeholder={language.DischargeSettlementBednumber && language.DischargeSettlementBednumber.message} value={this.state.bednumber} onChange={(event) => { this.bednum(event) }}
                                                    filterOption={(input, options) => options.props.title.toLowerCase().indexOf(input.toLowerCase()) >= 0} onSelect={this.Selectbednum}>
                                                    {this.state.bedData.map(item => <Option title={item.bedDesc} key={item.bedCBID} value={item.bedCBID}  >{item.bedDesc}</Option>)}
                                                </Select>
                                            </Input.Group>
                                        </Col>
                                    </Row> : ''}
                                    <Row className='mB10'>
                                        <Col span={25}>
                                            <Input.Group>
                                                <Input className='express-input-disable' style={{ width: '25%', textAlign: 'center' }} value={language.DischargeSettlementPatientinformation && language.DischargeSettlementPatientinformation.descripts + '：'} disabled />
                                                <Input id='patNo' style={{ width: '74.9%' }} allowClear placeholder={language.DischargeSettlementPatientinformation && language.DischargeSettlementPatientinformation.message} className='input' value={this.state.patNo} onChange={(event) => { this.patNo(event) }} onKeyUp={(e) => { this.patNodownE(e, 'patNo'); }} />
                                            </Input.Group>
                                        </Col>
                                    </Row>
                                    <Row className='mB10'>
                                        <Col span={25}>
                                            <Input.Group>
                                                <Input className='express-input-disable' style={{ width: '25%', textAlign: 'center' }} value={language.DischargeSettlementInpatientNo && language.DischargeSettlementInpatientNo.descripts + '：'} disabled />
                                                <Input allowClear style={{ width: '74.9%' }} placeholder={language.DischargeSettlementInpatientNo && language.DischargeSettlementInpatientNo.message} className='input' value={this.state.medicalNo} onChange={(event) => { this.medicalNo(event) }} onPressEnter={this.dataTableTopData} />
                                            </Input.Group>
                                        </Col>
                                    </Row>
                                    <Row className='mB10'>
                                        <Col span={25}>
                                            <Input.Group>
                                                <Input className='express-input-disable' style={{ width: '25%', textAlign: 'center' }} value={language.DischargeSettlementVisitingward && language.DischargeSettlementVisitingward.descripts + '：'} disabled />
                                                <Select className='express-select-border' allowClear style={{ width: '74.9%' }} placeholder={language.DischargeSettlementVisitingward && language.DischargeSettlementVisitingward.message} value={this.state.bqType} onChange={(event) => { this.bqType(event) }}  >
                                                    <Option value=''>{language.DischargeSettlementVisitingward && language.DischargeSettlementVisitingward.message}</Option>
                                                    {this.state.bqData.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                                                </Select>
                                            </Input.Group>
                                        </Col>
                                    </Row>
                                    {this.state.bqType == '' ? <Row className='mB10'>
                                        <Col span={25}>
                                            <Input.Group>
                                                <Input className='express-input-disable' style={{ width: '25%', textAlign: 'center' }} value={language.DischargeSettlementBednumber && language.DischargeSettlementBednumber.descripts + '：'} disabled />
                                                <Select className='express-select-border' allowClear showSearch style={{ width: '74.9%' }} placeholder={language.DischargeSettlementBednumber && language.DischargeSettlementBednumber.message} value={this.state.bednumber} onChange={(event) => { this.bednum(event) }}
                                                    filterOption={(input, options) => options.props.title.toLowerCase().indexOf(input.toLowerCase()) >= 0} onSelect={this.Selectbednum}>
                                                    {this.state.bedData.map(item => <Option title={item.bedDesc} key={item.bedCBID} value={item.bedCBID}  >{item.bedDesc}</Option>)}
                                                </Select>
                                            </Input.Group>
                                        </Col>
                                    </Row> : ''}
                                    <Row className='mB10'>
                                        <Col span={25}>
                                            <Input.Group>
                                                <Input className='express-input-disable' style={{ width: '25%', textAlign: 'center' }} value={language.DischargeSettlementSettlementtype && language.DischargeSettlementSettlementtype.descripts + '：'} disabled />
                                                <Select className='express-select-border' allowClear style={{ width: '74.9%' }} placeholder={language.DischargeSettlementVisitingward && language.DischargeSettlementVisitingward.message} value={this.state.jsType} onChange={(event) => { this.jsType(event) }}  >
                                                    <Option value=''>{language.DischargeSettlementVisitingward && language.DischargeSettlementVisitingward.message}</Option>
                                                    {this.state.jsTypeData.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                                                </Select>
                                            </Input.Group>
                                        </Col>
                                    </Row>
                                    {activeKey == 2 || activeKey == 3 ? '' :
                                        <Row className='mB10'>
                                            <Col span={25}>
                                                <Input.Group>
                                                    <Input className='express-input-disable' style={{ width: '25%', textAlign: 'center' }} value={language.DischargeSettlementChargeStatus && language.DischargeSettlementChargeStatus.descripts + '：'} disabled />
                                                    <Select className='express-select-border' allowClear style={{ width: '74.9%' }} placeholder={language.DischargeSettlementChargeStatus && language.DischargeSettlementChargeStatus.message} value={this.state.chargeStatus} onChange={(event) => { this.chargeStatus(event) }}  >
                                                        <Option value='P'>已结算</Option>
                                                        <Option value='B'>未结算</Option>
                                                    </Select>
                                                </Input.Group>
                                            </Col>
                                        </Row>
                                    }
                                    {activeKey == 3 ? '' :
                                        <Row className='mB10'>
                                            <Col span={25}>
                                                <Input.Group style={{ display: 'flex' }}>
                                                    {activeKey == 2 ? <Input className='express-input-disable' style={{ width: '32%', textAlign: 'center' }} value={'计费日期：'} disabled /> :
                                                        <div style={{ width: '25%' }}><Select className='express-select-right' style={{ width: '100%' }} allowClear placeholder="请选择时间" value={this.state.time1} onChange={(event) => { this.time1(event) }}  >
                                                            <Option value='1'>入院时间</Option>
                                                            <Option value='2'>出院时间</Option>
                                                        </Select></div>
                                                    }
                                                    <div><RangeDatePicker className='express-select-border' format='YYYY-MM-DD' style={{ width: '100%' }}
                                                        startChange={this.startChange.bind(this)} endChange={this.endChange.bind(this)} /></div>
                                                </Input.Group>
                                            </Col>
                                        </Row>}
                                    <Row style={{ textAlign: 'center', width: "100%" }}>
                                        <Button type='primary' style={{ marginRight: '2px', width: '99%' }} onClick={() => this.dataTableTopData()} >{language.DischargeSettlementquery && language.DischargeSettlementquery.descripts}</Button>
                                    </Row>
                                </div>

                            </div>
                        </Card>

                    </Col>
                    <Col span={19}>
                        <div>
                            {/*  height: store.getState().tableHeight.y + 135 + 'px', */}
                            <Card  >
                                <Tabs onChange={this.callback} activeKey={activeKey}  >
                                    <TabPane tab="就诊人列表" key="5">
                                        <Card style={{ width: '100%', padding: '0' }}
                                        >
                                            <div style={{ padding: 5 }}>
                                                <Table
                                                    pagination={false}
                                                    bordered
                                                    onChange={this.handleChange}
                                                    scroll={{ y: (store.getState().tableHeight.y) + 72, x: 1100 }}
                                                    columns={this.state.columnsTop}
                                                    dataSource={this.state.dataTableTop}
                                                    style={{ minHeight: (store.getState().tableHeight.y) + 122 + 'px' }}
                                                    onRow={(record) => {
                                                        return {
                                                            onClick: (event) => {
                                                                this.onClickRowPublicTop(record)
                                                            },
                                                        };
                                                    }}
                                                    rowClassName={(record) => this.setRowClassNamePublicTop(record)}
                                                />
                                                <ColumnAuthoritysModel
                                                    clientWidth='900px'
                                                    compontName={this.state.ColumnAuthority}
                                                    configType="C"
                                                    onRef={this.onColumnRef}
                                                    reloadData={() => {
                                                        this.cloumData(this.state.ColumnAuthority, this.state.ColumnAuthority)
                                                    }}
                                                />
                                                <CommonPagination size="small" current={paramTop.page} total={paramTop.total} search='search' pageSize='20'
                                                    onShowSizeChange={this.onShowSizeChangeTop.bind(this)} complete={false} dataSource={this.state.dataTableTop}
                                                    onChange={this.onChangeTop.bind(this)} />
                                            </div>
                                        </Card>
                                    </TabPane>
                                    <TabPane tab="住院费用总清单" key="1">
                                        <ListOfHospitalizationFeeQuery isPersonalInformation="false" admID={this.state.admID} />
                                    </TabPane>
                                    <TabPane tab="医嘱清单" key="0">
                                        <Card>
                                            <Row >
                                                <Col span={10}>
                                                    <div >
                                                        <TipHeader userInfo={this.state.userInfo} key={this.state.userInfo.patID + this.state.userInfo.accTSubID} />
                                                    </div>
                                                </Col>
                                                <Col span={14} >
                                                    <Row>
                                                        <Col span={4} style={{ textAlign: 'center', background: '#F7FBFF', marginLeft: 10 }}>
                                                            <div className='payBox'>
                                                                <p className='p2' style={{ color: '#007AFF' }}>￥<span>{this.state.money.patBillTotalAmt || '0'}</span></p>
                                                                <p>{language.DischargeSettlementCurrentamount && language.DischargeSettlementCurrentamount.descripts}</p>
                                                            </div>
                                                        </Col>
                                                        <Col span={4} style={{ textAlign: 'center', background: '#F7FBFF', marginLeft: 10 }}>
                                                            <div className='payBox'>
                                                                <p className='p2' style={{ color: '#007AFF' }}>￥<span>{this.state.money.patBillDiscountAmt || '0'}</span></p>
                                                                <p>{language.DischargeSettlementDiscount && language.DischargeSettlementDiscount.descripts}</p>
                                                            </div>
                                                        </Col>
                                                        <Col span={4} style={{ textAlign: 'center', background: '#F7FBFF', marginLeft: 10 }}>
                                                            <div className='payBox'>
                                                                <p className='p2' style={{ color: '#007AFF' }}>￥<span>{this.state.money.patBillPatAmt || '0'}</span></p>
                                                                <p>{language.DischargeSettlementPersonalexpense && language.DischargeSettlementPersonalexpense.descripts}</p>
                                                            </div>
                                                        </Col>
                                                        <Col span={4} style={{ textAlign: 'center', background: '#F7FBFF', marginLeft: 10 }}>
                                                            <div className='payBox'>
                                                                <p className='p2' style={{ color: '#007AFF' }}>￥<span>{this.state.money.admDeposit || '0'}</span></p>
                                                                <p>{language.DischargeSettlementAdvancepayment && language.DischargeSettlementAdvancepayment.descripts}</p>
                                                            </div>
                                                        </Col>
                                                        <Col span={4} style={{ textAlign: 'center', background: '#F7FBFF', marginLeft: 10 }}>
                                                            <div className='payBox'>
                                                                <p className='p2' style={{ color: '#007AFF' }}>￥<span>{this.state.money.leftAmt || '0'}</span></p>
                                                                <p>{language.DischargeSettlementCurrentbalance && language.DischargeSettlementCurrentbalance.descripts}</p>
                                                            </div>
                                                        </Col>
                                                    </Row>
                                                </Col>
                                            </Row>
                                        </Card>
                                        <Card style={{ width: '100%', padding: '0', height: store.getState().tableHeight.y + 90 + 'px' }} className='pd0' >
                                            <Row style={{ height: store.getState().tableHeight.y + 90 + 'px' }}>
                                                <Col span={16}>
                                                    <div style={{ padding: 5 }}>
                                                        <div className="table-operations">
                                                            <Row >
                                                                <Col span={24}>
                                                                    <Select allowClear style={{ width: '140px', margin: '0 15px 10px 0' }} placeholder={language.DischargeSettlementPleaseDepartment && language.DischargeSettlementPleaseDepartment.descripts} value={this.state.select2} onChange={(event) => { this.select2(event) }}  >
                                                                        <Option value=''>{language.DischargeSettlementPleaseDepartment && language.DischargeSettlementPleaseDepartment.descripts}</Option>
                                                                        {this.state.selectListData2.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                                                                    </Select>
                                                                    <Select allowClear style={{ width: '140px', margin: '0 15px 10px 0' }} placeholder={language.DischargeSettlementPleaseype && language.DischargeSettlementPleaseype.descripts} value={this.state.select3} onChange={(event) => { this.select3(event) }}  >
                                                                        <Option value=''>{language.DischargeSettlementPleaseype && language.DischargeSettlementPleaseype.descripts}</Option>
                                                                        {this.state.selectListData3.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                                                                    </Select>
                                                                    <Select allowClear style={{ width: '140px', margin: '0 15px 10px 0' }} placeholder={language.DischargeSettlementPleasestatus && language.DischargeSettlementPleasestatus.descripts} value={this.state.select1} onChange={(event) => { this.select1(event) }}  >
                                                                        <Option value=''>{language.DischargeSettlementPleasestatus && language.DischargeSettlementPleasestatus.descripts}</Option>
                                                                        {this.state.selectListData1.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                                                                    </Select>
                                                                    <Input allowClear style={{ width: '140px', margin: '0 15px 10px 0' }} placeholder={language.DischargeSettlementEnteritemquery && language.DischargeSettlementEnteritemquery.descripts} className='input' value={this.state.nameNo} onChange={(event) => { this.nameNo(event) }} onKeyUp={(e) => { this.nameNodownE(e); }} />
                                                                    <span style={{ display: 'inline-block', margin: '0 15px 10px 0', verticalAlign: 'top', width: '280px' }}><RangeDatePicker format='YYYY-MM-DD' style={{ width: '100%' }}
                                                                        startChange={this.startChange1.bind(this)} endChange={this.endChange1.bind(this)} /></span>
                                                                    <Button type='primary' onClick={() => this.dataTable1Data()} >{language.DischargeSettlementquery && language.DischargeSettlementquery.descripts}</Button>
                                                                </Col>
                                                            </Row>
                                                        </div>
                                                        <div className="table-body-height">
                                                            {/* handelThis将夫组件的属性与方法给子组件访问 */}
                                                            <PubilcTablePagination
                                                                param={param}
                                                                handelThis={this}
                                                                onRef={this.onRef}
                                                                onClickRowPublic={this.onClickRowPublic1}
                                                                setRowClassNamePublic={this.setRowClassNamePublic1}
                                                            />
                                                        </div>
                                                    </div>
                                                </Col>
                                                <Col span={8}>
                                                    <Row >
                                                        <Card style={{ width: '100%', padding: '0', height: '350px' }} className='pd0'
                                                            title={<span>
                                                                <span style={{ borderRight: '5px solid', color: '#007AFF', marginRight: 5, width: 5 }}></span>
                                                                {language.DischargeSettlementExecutionrecord && language.DischargeSettlementExecutionrecord.descripts}
                                                                <Button size='small' type='primary' style={{ marginLeft: 5 }} disabled={Util.isEmpty(this.state.execID)}
                                                                    onClick={this.handleExecList.bind(this, 'CE')}>撤销执行</Button>
                                                                <Button size='small' type='primary' style={{ marginLeft: 5 }} disabled={Util.isEmpty(this.state.execID)}
                                                                    onClick={this.handleExecList.bind(this, 'DE')}>停止执行</Button>
                                                            </span>}>
                                                            <div style={{ padding: 12 }} >
                                                                <Table
                                                                    className="smallTable table-body-height"
                                                                    pagination={false}
                                                                    bordered
                                                                    scroll={{ y: 250, x: 1100 }}
                                                                    style={{ minHeight: '350px' }}

                                                                    columns={this.state.columns2}
                                                                    dataSource={this.state.dataTable2}
                                                                    onRow={(record) => {
                                                                        return {
                                                                            onClick: (event) => {
                                                                                this.setState({ execID: record.execID }, () => {
                                                                                    this.dataTable3Data(record)
                                                                                })
                                                                            },
                                                                        };
                                                                    }}
                                                                    rowClassName={this.setRowClassNamePublic2}
                                                                />
                                                            </div>
                                                        </Card>
                                                    </Row>
                                                    <Row >
                                                        <Card style={{ width: '100%', padding: '0', height: '250px' }} className='pd0'
                                                            title={<span>
                                                                {language.DischargeSettlementDetailsexpenses && language.DischargeSettlementDetailsexpenses.descripts}</span>}>
                                                            <Table
                                                                className="smallTable table-body-height"
                                                                pagination={false}
                                                                bordered
                                                                columns={this.state.columns3}
                                                                dataSource={this.state.dataTable3}
                                                                scroll={{ y: 250, x: 700 }}
                                                                style={{ minHeight: '150px' }}
                                                            />
                                                        </Card>
                                                    </Row>

                                                </Col>
                                            </Row>
                                        </Card>
                                    </TabPane>
                                    <TabPane tab="发票信息" key="3" >
                                        <Col span={24}>
                                            <Table
                                                pagination={false}
                                                bordered
                                                scroll={{ y: store.getState().tableHeight.y - 10, x: 1100 }}
                                                columns={this.state.columnsInvoice}
                                                dataSource={this.state.dateTableInvoice}
                                                className="table-body-height"
                                            />
                                            <ColumnAuthoritysModel
                                                clientWidth='900px'
                                                compontName='InvoiceInformation'
                                                configType="C"
                                                onRef={this.onColumnRef}
                                                reloadData={() => {
                                                    this.InvoiceList1()
                                                }}
                                            />
                                        </Col>

                                    </TabPane>
                                    <TabPane tab="预交金明细" key="4" >
                                        <Col span={24}>
                                            <Table
                                                pagination={false}
                                                bordered
                                                scroll={{ y: store.getState().tableHeight.y - 10, x: 1100 }}
                                                columns={this.state.accColumns}
                                                dataSource={this.state.accTableData}
                                                className="table-body-height"
                                            />
                                        </Col>
                                    </TabPane>
                                </Tabs>
                            </Card>
                        </div>
                    </Col>
                </Row>
            </div >


        )
    }
}